FIG. 16 is a schematic view showing a conventional example of an electronic device. The electronic device 200 of the conventional example includes a magnetic sensor IC 230 (for example, a bipolar detection Hall IC) built in a main body 210 and a magnet 240 built in a cover 220, both of which serve as a means for determining a first state (a left side in FIG. 16) in which the upper surface of the main body 210 is covered with the cover 220 and a second state (a right side in FIG. 16) in which the lower surface of the main body 210 is covered with the cover 220. The magnet 240 is disposed such that the magnetization direction thereof is parallel to the major surfaces of the cover 220.
The magnetic sensor IC 230 is disposed such that package major surfaces (i.e., upper surface and lower surface) thereof are parallel to the major surfaces of the main body 210, and is configured to detect the magnetic field (perpendicular magnetic field) perpendicularly applied the package major surfaces. According to FIG. 16, in the first state (the left side in FIG. 16), the magnetic sensor IC 230 detects a perpendicular magnetic field directed from the upper surface of the package to the lower surface of the package. On the other hand, in the second state (the right side in FIG. 16), the magnetic sensor IC 230 detects a perpendicular magnetic field directed from the lower surface of the package to the upper surface of the package. Accordingly, it is possible to distinguish between the first state (the left side in FIG. 16) and the second state (the right side in FIG. 16) based on whether the output polarity of the magnetic sensor IC 230 is positive or negative.
FIG. 17 is a schematic view for defining the displacement amounts (X, Y and Z) of the magnetic sensor IC 230 with respect to the magnet 240. As shown in FIG. 17, the displacement amount X in the left-right direction of the drawing sheet, the displacement amount Y in the front-back direction of the drawing sheet and the displacement amount Z in the up-down direction of the drawing sheet are respectively defined using the center of the lower surface of the magnet 240 as an origin O (0, 0 and 0). As for the positive and negative polarities of the displacement amounts (X, Y and Z), the rightward direction of the drawing sheet, the backward direction of the drawing sheet (a direction going into the sheet) and the downward direction of the drawing sheet are respectively set as positive directions.
FIG. 18 is a view showing the correlation between displacement amounts X and Z (displacement amount Y=0) of the magnetic sensor IC 230 and the perpendicular magnetic field. In FIG. 18, the horizontal axis represents the displacement amount X (mm) while the vertical axis represents the displacement amount Z (mm). In addition, as preconditions of FIG. 18, it is assumed that the magnet 240 is in the form of a thin plate having a length of 7.5 mm (in the left-right direction of the drawing sheet), a width of 7.5 mm (in the front-back direction of the drawing sheet), and a height of 0.5 mm (in the up-down direction of the drawing sheet). It is also assumed that the residual magnetic flux density of the magnet 240 is 1400 mT.
The gradation region in FIG. 18 is a region where the perpendicular magnetic field is 5 mT or more. In addition, it shows that the higher the gradation concentration, the larger the perpendicular magnetic field. In order to correctly distinguish the displacement states of the main body 210 and the cover 220 from the orientation of the perpendicular magnetic field detected by the magnetic sensor IC 230, it is necessary to position the magnetic sensor IC 230 and the magnet 240 so that in the first state or the second state described above, the magnetic sensor IC 230 is disposed within the gradation region shown in FIG. 18 (in the position shifted obliquely from the front face of the magnetic pole of the magnet 240).
However, in the electronic device 200 of the aforementioned conventional example, the magnetic field at the position obliquely shifted from the front face of the magnetic pole of the magnet 240 is only about one half of the magnetic field generated on the front surface of the magnetic pole at the maximum. Thus, even if the magnetic field is slightly shifted away from the magnet 240, the magnetic field is greatly attenuated.
For this reason, in the electronic device 200 of the conventional example described above, the detection distance of the magnetic sensor IC 230 (the distance at which the perpendicular magnetic field can be correctly detected) is short and the magnetic sensor IC 230 is vulnerable to noise. Thus, unintentional malfunction (erroneous state determination) may possibly occur due to the position shift of the cover 220.
Moreover, in the electronic device 200 of the conventional example described above, when the displacement amount X of the magnetic sensor IC 230 is changed from plus to minus, the direction of the perpendicular magnetic field applied to the magnetic sensor IC 230 is reversed. Thus, there is a possibility that the displacement states of the main body 210 and the cover 220 are erroneously detected.
In the related art, it is necessary to obliquely tilt the magnet provided in the cover obliquely with respect to the surface of the main body. This makes it very difficult to mount the magnet. Thus, there is a problem in that the thickness of the cover becomes large.